/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package technicRMLL73.impl;

import boundRMLL73.BoundRMLL73;

import generalArchitecture.impl.ComputeBoxImpl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import processorUtilizationNB.ProcessorUtilisationNB;

import technicRMLL73.Status;
import technicRMLL73.TechnicRMLL73;
import technicRMLL73.TechnicRMLL73Package;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Technic RMLL73</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link technicRMLL73.impl.TechnicRMLL73Impl#getPU <em>PU</em>}</li>
 *   <li>{@link technicRMLL73.impl.TechnicRMLL73Impl#getBoundLL73 <em>Bound LL73</em>}</li>
 *   <li>{@link technicRMLL73.impl.TechnicRMLL73Impl#getSchedulable <em>Schedulable</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TechnicRMLL73Impl extends ComputeBoxImpl implements TechnicRMLL73 {
	/**
	 * The cached value of the '{@link #getPU() <em>PU</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPU()
	 * @generated
	 * @ordered
	 */
	protected ProcessorUtilisationNB pU;

	/**
	 * The cached value of the '{@link #getBoundLL73() <em>Bound LL73</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBoundLL73()
	 * @generated
	 * @ordered
	 */
	protected BoundRMLL73 boundLL73;

	/**
	 * The default value of the '{@link #getSchedulable() <em>Schedulable</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSchedulable()
	 * @generated
	 * @ordered
	 */
	protected static final Status SCHEDULABLE_EDEFAULT = Status.UNDETERMINED;

	/**
	 * The cached value of the '{@link #getSchedulable() <em>Schedulable</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSchedulable()
	 * @generated
	 * @ordered
	 */
	protected Status schedulable = SCHEDULABLE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TechnicRMLL73Impl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return TechnicRMLL73Package.Literals.TECHNIC_RMLL73;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ProcessorUtilisationNB getPU() {
		if (pU != null && pU.eIsProxy()) {
			InternalEObject oldPU = (InternalEObject)pU;
			pU = (ProcessorUtilisationNB)eResolveProxy(oldPU);
			if (pU != oldPU) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, TechnicRMLL73Package.TECHNIC_RMLL73__PU, oldPU, pU));
			}
		}
		return pU;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ProcessorUtilisationNB basicGetPU() {
		return pU;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPU(ProcessorUtilisationNB newPU) {
		ProcessorUtilisationNB oldPU = pU;
		pU = newPU;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TechnicRMLL73Package.TECHNIC_RMLL73__PU, oldPU, pU));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BoundRMLL73 getBoundLL73() {
		if (boundLL73 != null && boundLL73.eIsProxy()) {
			InternalEObject oldBoundLL73 = (InternalEObject)boundLL73;
			boundLL73 = (BoundRMLL73)eResolveProxy(oldBoundLL73);
			if (boundLL73 != oldBoundLL73) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, TechnicRMLL73Package.TECHNIC_RMLL73__BOUND_LL73, oldBoundLL73, boundLL73));
			}
		}
		return boundLL73;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BoundRMLL73 basicGetBoundLL73() {
		return boundLL73;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBoundLL73(BoundRMLL73 newBoundLL73) {
		BoundRMLL73 oldBoundLL73 = boundLL73;
		boundLL73 = newBoundLL73;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TechnicRMLL73Package.TECHNIC_RMLL73__BOUND_LL73, oldBoundLL73, boundLL73));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Status getSchedulable() {
		return schedulable;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSchedulable(Status newSchedulable) {
		Status oldSchedulable = schedulable;
		schedulable = newSchedulable == null ? SCHEDULABLE_EDEFAULT : newSchedulable;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TechnicRMLL73Package.TECHNIC_RMLL73__SCHEDULABLE, oldSchedulable, schedulable));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public void compute() {
					
			/* First case: comparison succeed */
			if ((this.boundLL73 != null && this.pU != null) && this.boundLL73.getValue() >= this.pU.getU()) {
				
				this.setSchedulable(Status.SCHEDULABLE);
			}

	} // compute()


	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case TechnicRMLL73Package.TECHNIC_RMLL73__PU:
				if (resolve) return getPU();
				return basicGetPU();
			case TechnicRMLL73Package.TECHNIC_RMLL73__BOUND_LL73:
				if (resolve) return getBoundLL73();
				return basicGetBoundLL73();
			case TechnicRMLL73Package.TECHNIC_RMLL73__SCHEDULABLE:
				return getSchedulable();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case TechnicRMLL73Package.TECHNIC_RMLL73__PU:
				setPU((ProcessorUtilisationNB)newValue);
				return;
			case TechnicRMLL73Package.TECHNIC_RMLL73__BOUND_LL73:
				setBoundLL73((BoundRMLL73)newValue);
				return;
			case TechnicRMLL73Package.TECHNIC_RMLL73__SCHEDULABLE:
				setSchedulable((Status)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case TechnicRMLL73Package.TECHNIC_RMLL73__PU:
				setPU((ProcessorUtilisationNB)null);
				return;
			case TechnicRMLL73Package.TECHNIC_RMLL73__BOUND_LL73:
				setBoundLL73((BoundRMLL73)null);
				return;
			case TechnicRMLL73Package.TECHNIC_RMLL73__SCHEDULABLE:
				setSchedulable(SCHEDULABLE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case TechnicRMLL73Package.TECHNIC_RMLL73__PU:
				return pU != null;
			case TechnicRMLL73Package.TECHNIC_RMLL73__BOUND_LL73:
				return boundLL73 != null;
			case TechnicRMLL73Package.TECHNIC_RMLL73__SCHEDULABLE:
				return schedulable != SCHEDULABLE_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (schedulable: ");
		result.append(schedulable);
		result.append(')');
		return result.toString();
	}

} //TechnicRMLL73Impl
